
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>06 函数 · 书名</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="作者">
        <meta name="identifier" content="图书编号" scheme="ISBN">
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-intopic-toc/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="07 约束.html" />
    
    
    <link rel="prev" href="05 DCL.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    书名
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Books</li>
        
        
    
        <li class="chapter " data-level="2.1" >
            
                <span>
            
                    
                    Java
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../java/001环境变量.html">
            
                <a href="../java/001环境变量.html">
            
                    
                    001环境变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../java/002Java初体验.html">
            
                <a href="../java/002Java初体验.html">
            
                    
                    002Java初体验
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="../java/003变量命名及数据类型.html">
            
                <a href="../java/003变量命名及数据类型.html">
            
                    
                    003变量命名及数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="../java/004运算符.html">
            
                <a href="../java/004运算符.html">
            
                    
                    004运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="../java/005选择结构.html">
            
                <a href="../java/005选择结构.html">
            
                    
                    005选择结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="../java/006循环结构.html">
            
                <a href="../java/006循环结构.html">
            
                    
                    006循环结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7" data-path="../java/007数组.html">
            
                <a href="../java/007数组.html">
            
                    
                    007数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.8" data-path="../java/008类和对象方法.html">
            
                <a href="../java/008类和对象方法.html">
            
                    
                    008类和对象方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.9" data-path="../java/009构造方法.html">
            
                <a href="../java/009构造方法.html">
            
                    
                    009构造方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.10" data-path="../java/010封装与关键字static.html">
            
                <a href="../java/010封装与关键字static.html">
            
                    
                    010封装与关键字Static
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.11" data-path="../java/011 继承.html">
            
                <a href="../java/011 继承.html">
            
                    
                    011 继承
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.12" data-path="../java/012方法重写.html">
            
                <a href="../java/012方法重写.html">
            
                    
                    012方法重写
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.13" data-path="../java/013多态.html">
            
                <a href="../java/013多态.html">
            
                    
                    013多态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.14" data-path="../java/014抽象类抽象方法.html">
            
                <a href="../java/014抽象类抽象方法.html">
            
                    
                    014抽象类抽象方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.15" data-path="../java/015接口.html">
            
                <a href="../java/015接口.html">
            
                    
                    015接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.16" data-path="../java/016异常.html">
            
                <a href="../java/016异常.html">
            
                    
                    016异常
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.17" data-path="../java/017集合.html">
            
                <a href="../java/017集合.html">
            
                    
                    017集合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.18" data-path="../java/017集合2.html">
            
                <a href="../java/017集合2.html">
            
                    
                    017集合2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.19" data-path="../java/018泛型.html">
            
                <a href="../java/018泛型.html">
            
                    
                    018泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.20" data-path="../java/019Collections算法类.html">
            
                <a href="../java/019Collections算法类.html">
            
                    
                    019Collections算法类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.21" data-path="../java/020枚举.html">
            
                <a href="../java/020枚举.html">
            
                    
                    020枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.22" data-path="../java/021包装类.html">
            
                <a href="../java/021包装类.html">
            
                    
                    021包装类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.23" data-path="../java/022常用类.html">
            
                <a href="../java/022常用类.html">
            
                    
                    022常用类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.24" data-path="../java/023File类.html">
            
                <a href="../java/023File类.html">
            
                    
                    023File类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.25" data-path="../java/024IO流.html">
            
                <a href="../java/024IO流.html">
            
                    
                    024IO流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.26" data-path="../java/025多线程.html">
            
                <a href="../java/025多线程.html">
            
                    
                    025多线程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.27" data-path="../java/025多线程线程池.html">
            
                <a href="../java/025多线程线程池.html">
            
                    
                    025多线程线程池
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.28" data-path="../java/026网络编程Socket.html">
            
                <a href="../java/026网络编程Socket.html">
            
                    
                    026网络编程Socket
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.29" data-path="../java/027XML解析.html">
            
                <a href="../java/027XML解析.html">
            
                    
                    027XML解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.30" data-path="../java/028 注解.html">
            
                <a href="../java/028 注解.html">
            
                    
                    028 注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.31" data-path="../java/029 Lambda表达式.html">
            
                <a href="../java/029 Lambda表达式.html">
            
                    
                    029 Lambda表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.32" data-path="../java/029 反射.html">
            
                <a href="../java/029 反射.html">
            
                    
                    029 反射
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" >
            
                <span>
            
                    
                    Mybatis
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../mybatis/MyBatis.html">
            
                <a href="../mybatis/MyBatis.html">
            
                    
                    MyBatis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1.1" >
            
                <span>
            
                    
                    MyBatis
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" >
            
                <span>
            
                    
                    Mysql
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="01 SQL通用语法.html">
            
                <a href="01 SQL通用语法.html">
            
                    
                    01 SQL通用语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="02 DDL.html">
            
                <a href="02 DDL.html">
            
                    
                    02 DDL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.3" data-path="03 DML.html">
            
                <a href="03 DML.html">
            
                    
                    03 DML
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.4" data-path="04 DQL.html">
            
                <a href="04 DQL.html">
            
                    
                    04 DQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.5" data-path="05 DCL.html">
            
                <a href="05 DCL.html">
            
                    
                    05 DCL
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.3.6" data-path="06 函数.html">
            
                <a href="06 函数.html">
            
                    
                    06 函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.7" data-path="07 约束.html">
            
                <a href="07 约束.html">
            
                    
                    07 约束
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.8" data-path="08 多表查询.html">
            
                <a href="08 多表查询.html">
            
                    
                    08 多表查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.9" data-path="09 事务.html">
            
                <a href="09 事务.html">
            
                    
                    09 事务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.10" data-path="999zzz.html">
            
                <a href="999zzz.html">
            
                    
                    999zzz
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.11" data-path="MySql.html">
            
                <a href="MySql.html">
            
                    
                    MySql
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.12" data-path="sql.html">
            
                <a href="sql.html">
            
                    
                    Sql
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" >
            
                <span>
            
                    
                    Spring
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../spring/spring.html">
            
                <a href="../spring/spring.html">
            
                    
                    Spring
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" >
            
                <span>
            
                    
                    SpringMVC
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../springMVC/springMVC.html">
            
                <a href="../springMVC/springMVC.html">
            
                    
                    SpringMVC
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" >
            
                <span>
            
                    
                    整合
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="../整合/Mybatis框架.html">
            
                <a href="../整合/Mybatis框架.html">
            
                    
                    Mybatis框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.2" data-path="../整合/SpringBoot.html">
            
                <a href="../整合/SpringBoot.html">
            
                    
                    SpringBoot
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.3" data-path="../整合/springmvc框架.html">
            
                <a href="../整合/springmvc框架.html">
            
                    
                    Springmvc框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.4" data-path="../整合/spring框架.html">
            
                <a href="../整合/spring框架.html">
            
                    
                    Spring框架
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >06 函数</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x5B57;&#x7B26;&#x4E32;&#x51FD;&#x6570;">&#x5B57;&#x7B26;&#x4E32;&#x51FD;&#x6570;</h1>
<table>
<thead>
<tr>
<th>&#x51FD;&#x6570;</th>
<th>&#x529F;&#x80FD;</th>
</tr>
</thead>
<tbody>
<tr>
<td>concat(s1,s2,s3,...sn)</td>
<td>&#x5B57;&#x7B26;&#x4E32;&#x62FC;&#x63A5;</td>
</tr>
<tr>
<td>lower(str)</td>
<td>&#x8F6C;&#x6362;&#x6210;&#x5C0F;&#x5199;</td>
</tr>
<tr>
<td>upper(str)</td>
<td>&#x8F6C;&#x6362;&#x6210;&#x5927;&#x5199;</td>
</tr>
<tr>
<td>lpad(str, n, pad)</td>
<td>&#x5DE6;&#x586B;&#x5145;, &#x7528;&#x5B57;&#x7B26;&#x4E32;pad &#x5BF9; str &#x7684;&#x5DE6;&#x8FB9;&#x8FDB;&#x884C;&#x586B;&#x5145;, &#x8FBE;&#x5230; n &#x4E2A;&#x5B57;&#x7B26;&#x957F;&#x5EA6;</td>
</tr>
<tr>
<td>rpad(str, n, pad)</td>
<td>&#x53F3;&#x586B;&#x5145;, &#x7528;&#x5B57;&#x7B26;&#x4E32;pad &#x5BF9; str &#x7684;&#x53F3;&#x8FB9;&#x8FDB;&#x884C;&#x586B;&#x5145;, &#x8FBE;&#x5230; n &#x4E2A;&#x5B57;&#x7B26;&#x957F;&#x5EA6;</td>
</tr>
<tr>
<td>trim(str)</td>
<td>&#x53BB;&#x9664;&#x5B57;&#x7B26;&#x4E32;&#x90FD;&#x5934;&#x90E8;&#x548C;&#x5C3E;&#x90E8;&#x7684;&#x7A7A;&#x683C;</td>
</tr>
<tr>
<td>substring(str, start, len)</td>
<td>&#x8FD4;&#x56DE;&#x4ECE;&#x5B57;&#x7B26;&#x4E32; str &#x4ECE;start&#x4F4D;&#x7F6E;&#x8D77;&#x7684; len &#x4E2A;&#x957F;&#x5EA6;&#x7684;&#x5B57;&#x7B26;&#x4E32;</td>
</tr>
</tbody>
</table>
<h1 id="&#x6570;&#x503C;&#x51FD;&#x6570;">&#x6570;&#x503C;&#x51FD;&#x6570;</h1>
<table>
<thead>
<tr>
<th>&#x51FD;&#x6570;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>ceil(x)</td>
<td>&#x5411;&#x4E0A;&#x53D6;&#x6574;</td>
</tr>
<tr>
<td>floor(x)</td>
<td>&#x5411;&#x4E0B;&#x53D6;&#x6574;</td>
</tr>
<tr>
<td>mod(x,y)</td>
<td>&#x8FD4;&#x56DE;x/y&#x7684;&#x6478;</td>
</tr>
<tr>
<td>rand()</td>
<td>&#x8FD4;&#x56DE;0~1&#x5185;&#x7684;&#x968F;&#x673A;&#x6570;</td>
</tr>
<tr>
<td>round(x,y)</td>
<td>&#x6C42;&#x53C2;&#x6570; X &#x7684;&#x56DB;&#x820D;&#x4E94;&#x5165;&#x7684;&#x503C;, &#x4FDD;&#x7559;y&#x4E3A;&#x5C0F;&#x6570;</td>
</tr>
</tbody>
</table>
<h1 id="&#x65E5;&#x671F;&#x51FD;&#x6570;">&#x65E5;&#x671F;&#x51FD;&#x6570;</h1>
<table>
<thead>
<tr>
<th>&#x51FD;&#x6570;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>curdate()</td>
<td>&#x8FD4;&#x56DE;&#x5F53;&#x524D;&#x65E5;&#x671F;</td>
</tr>
<tr>
<td>curtime()</td>
<td>&#x8FD4;&#x56DE;&#x5F53;&#x524D;&#x65F6;&#x95F4;</td>
</tr>
<tr>
<td>now()</td>
<td>&#x8FD4;&#x56DE;&#x5F53;&#x524D;&#x65E5;&#x671F;&#x548C;&#x65F6;&#x95F4;</td>
</tr>
<tr>
<td>year(date)</td>
<td>&#x83B7;&#x53D6;&#x6307;&#x5B9A;date&#x7684;&#x5E74;&#x4EFD;</td>
</tr>
<tr>
<td>month(date)</td>
<td>&#x83B7;&#x53D6;&#x6307;&#x5B9A;date&#x7684;&#x6708;&#x4EFD;</td>
</tr>
<tr>
<td>day(date)</td>
<td>&#x83B7;&#x53D6;&#x6307;&#x5B9A;date&#x7684;&#x65E5;&#x671F;</td>
</tr>
<tr>
<td>date_add(date, interval expr type)</td>
<td>&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x65E5;&#x671F;/&#x65F6;&#x95F4;&#x503C;&#x52A0;&#x4E0A;&#x4E00;&#x4E2A;&#x65F6;&#x95F4;&#x95F4;&#x9694; expr &#x540E;&#x7684;&#x65F6;&#x95F4;&#x503C;</td>
</tr>
<tr>
<td>datediff(date1, date2)</td>
<td>&#x8FD4;&#x56DE;&#x8D77;&#x59CB;&#x65F6;&#x95F4;date1 &#x548C; &#x7ED3;&#x675F;&#x65F6;&#x95F4; date2 &#x4E4B;&#x95F4;&#x7684;&#x5929;&#x6570;</td>
</tr>
</tbody>
</table>
<h1 id="&#x6D41;&#x7A0B;&#x51FD;&#x6570;">&#x6D41;&#x7A0B;&#x51FD;&#x6570;</h1>
<p>&#x6D41;&#x7A0B;&#x51FD;&#x6570;&#x53EF;&#x4EE5;&#x5728;SQL&#x8BED;&#x53E5;&#x4E2D;&#x5B9E;&#x73B0;&#x6761;&#x4EF6;&#x7B5B;&#x9009;, &#x4ECE;&#x800C;&#x63D0;&#x9AD8;&#x8BED;&#x53E5;&#x7684;&#x6548;&#x7387;</p>
<table>
<thead>
<tr>
<th>&#x51FD;&#x6570;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>if(value, t, f)</td>
<td>&#x5982;&#x679C;value&#x4E3A;true, &#x8FD4;&#x56DE; t, &#x5426;&#x5219;&#x8FD4;&#x56DE; f</td>
</tr>
<tr>
<td>ifnull(value1, value2)</td>
<td>&#x5982;&#x679C;value1&#x7684;&#x503C;&#x4E3A;&#x7A7A;, &#x5219;&#x8FD4;&#x56DE; value2; &#x5426;&#x5219;&#x8FD4;&#x56DE;value1</td>
</tr>
<tr>
<td>case when [val1] then [res1] ... else [default] end</td>
<td>&#x5982;&#x679C;val1&#x4E3A;true ,&#x8FD4;&#x56DE;res1, ... &#x5426;&#x5219;&#x8FD4;&#x56DE; default&#x9ED8;&#x8BA4;&#x503C;</td>
</tr>
<tr>
<td>case [expt] when [val1] then [res1] ... else [defalut] end</td>
<td>&#x5982;&#x679C;expr&#x7684;&#x503C;&#x7B49;&#x4E8E;val1&#x8FD4;&#x56DE; res1, ... &#x5426;&#x5219;&#x8FD4;&#x56DE;default&#x9ED8;&#x8BA4;&#x503C;</td>
</tr>
</tbody>
</table>
<pre><code class="lang-mysql">-- if
select if(false, &apos;ok&apos;, &apos;error&apos;);

-- ifnull
select ifnull(&apos;ok&apos;, &apos;default&apos;);

-- ccase [expt] when [val1] then [res1] ... else [defalut] end
select name, (case workaddress when &apos;&#x4E0A;&#x6D77;&apos; then &apos;&#x4E00;&#x7EBF;&#x57CE;&#x5E02;&apos; when &apos;&#x5317;&#x4EAC;&apos; then &apos;&#x4E00;&#x7EBF;&#x57CE;&#x5E02;&apos; end) as &apos;&#x5DE5;&#x4F5C;&#x5730;&#x70B9;&apos; 
from tmp; 

-- case when [val1] then [res1] ... else [default] end
select
    id,
    name,
    (case when math &gt;= 85 then &apos;&#x4F18;&#x79C0;&apos; when math &gt;= 30 then &apos;&#x53CA;&#x683C;&apos; else &apos;&#x4E0D;&#x53CA;&#x683C;&apos; end) &apos;&#x6570;&#x5B66;&apos;,
    (case when english &gt;= 85 then &apos;&#x4F18;&#x79C0;&apos; when english &gt;= 30 then &apos;&#x53CA;&#x683C;&apos; else &apos;&#x4E0D;&#x53CA;&#x683C;&apos; end) &apos;&#x82F1;&#x8BED;&apos;,
    (case when chinese &gt;= 85 then &apos;&#x4F18;&#x79C0;&apos; when chinese &gt;= 30 then &apos;&#x53CA;&#x683C;&apos; else &apos;&#x4E0D;&#x53CA;&#x683C;&apos; end) &apos;&#x8BED;&#x6587;&apos;
from score;
</code></pre>
<h1 id="&#x5C0F;&#x7ED3;">&#x5C0F;&#x7ED3;</h1>
<ol>
<li><p>&#x5B57;&#x7B26;&#x4E32;&#x51FD;&#x6570;</p>
<pre><code class="lang-mysql">concat,
lower,
upper,
lpad,
rpad,
trim,
substring
</code></pre>
</li>
</ol>
<ol>
<li><p>&#x6570;&#x503C;&#x51FD;&#x6570;</p>
<pre><code class="lang-mysql">ceil,
floor,
mod,
rand,
round
</code></pre>
</li>
</ol>
<ol>
<li><p>&#x65E5;&#x671F;&#x51FD;&#x6570;</p>
<pre><code class="lang-mysql">curdate,
curtime,
now,
year,
month,
day,
date_add
datediff
</code></pre>
</li>
</ol>
<ol>
<li><p>&#x6D41;&#x7A0B;&#x51FD;&#x6570;</p>
<pre><code class="lang-mysql">if,
ifnull,
case [...] when .. then ... else ... end
</code></pre>
</li>
</ol>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="05 DCL.html" class="navigation navigation-prev " aria-label="Previous page: 05 DCL">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="07 约束.html" class="navigation navigation-next " aria-label="Next page: 07 约束">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"06 函数","level":"2.3.6","depth":2,"next":{"title":"07 约束","level":"2.3.7","depth":2,"path":"books/mysql/07 约束.md","ref":"books/mysql/07 约束.md","articles":[]},"previous":{"title":"05 DCL","level":"2.3.5","depth":2,"path":"books/mysql/05 DCL.md","ref":"books/mysql/05 DCL.md","articles":[]},"dir":"ltr"},"config":{"plugins":["search-pro","code","back-to-top-button","theme-comscore","intopic-toc","flexible-alerts","expandable-chapters"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"intopic-toc":{"selector":".markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section h5, .markdown-section h6","mode":"nested","maxDepth":6,"isCollapsed":true,"isScrollspyActive":true,"visible":true,"label":"In this article"},"search-pro":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"code":{"copyButtons":true},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"theme-comscore":{},"back-to-top-button":{},"flexible-alerts":{"style":"callout","note":{"label":"Note","icon":"fa fa-info-circle","className":"info"},"tip":{"label":"Tip","icon":"fa fa-lightbulb-o","className":"tip"},"warning":{"label":"Warning","icon":"fa fa-exclamation-triangle","className":"warning"},"danger":{"label":"Attention","icon":"fa fa-ban","className":"danger"}},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"作者","lang":"zh-cn","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"isbn":"图书编号","variables":{},"title":"书名","gitbook":"*","description":"描述"},"file":{"path":"books/mysql/06 函数.md","mtime":"2022-09-01T09:08:07.359Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2023-03-01T12:24:55.135Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-intopic-toc/anchor.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-intopic-toc/gumshoe.polyfills.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-intopic-toc/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

